objs = startup_s3c2440.o 
objs += led/led.o 
objs += uart/uart.o 
objs += system_s3c2440.o 
objs += nand_flash/nand_flash.o
objs += main.o
objs += uart/exception.o
objs += s3c2440_it.o
objs += timer/timer.o
objs += nor_flash/nor_flash.o
objs += uart/my_printf.o
objs += uart/string_utils.o
objs += lib1funcs.o
objs += lcd/font.o
objs += lcd/framebuffer.o
objs += lcd/geometry.o
objs += lcd/lcd.o
objs += lcd/lcd_4_3.o
objs += lcd/lcd_controller.o
objs += lcd/lcd_test.o
objs += lcd/s3c2440_lcd_controller.o
objs += lcd/font_8x16.o

all: $(objs)
	#arm-linux-ld -Ttext 0 -Tdata 0x30000000  start.o led.o uart.o init.o main.o -o s3c2440.elf
	arm-linux-ld -T s3c2440.lds $^ -o s3c2440.elf
	arm-linux-objcopy -O binary -S s3c2440.elf s3c2440.bin
	arm-linux-objdump -D s3c2440.elf > s3c2440.dis
	#arm-linux-gnueabihf-ld -T s3c2440.lds $^ -o s3c2440.elf
	#arm-linux-gnueabihf-objcopy -O binary -S s3c2440.elf s3c2440.bin
	#arm-linux-gnueabihf-objdump -D s3c2440.elf > s3c2440.dis
clean:
	rm *.bin *.o *.elf *.dis
	cd ./lcd; rm *.o;cd ../uart; rm *.o; cd ../nor_flash; rm *.o; cd ../led; rm *.o;cd ../nand_flash; rm *.o; cd ../timer; rm *.o
           
%.o : %.c
	arm-linux-gcc -march=armv4 -c -o $@ $<
	#arm-linux-gnueabihf-gcc -march=armv4 -c -o $@ $<
%.o : %.S
	arm-linux-gcc -march=armv4 -c -o $@ $<
	#arm-linux-gnueabihf-gcc -march=armv4 -c -o $@ $<
	
